import sys
import libvirt

conn = libvirt.open('qemu:///system')

if conn is None:
    print('Failed to open connection to qemu:///system')
    sys.exit(1)

host = conn.getHostname()
print('Hostname is: {0}'.format(host))

conn.close()

